package owlapps2012.owlToSql.events.p4;

import java.awt.BorderLayout;

import javax.swing.JScrollPane;

import org.protege.editor.owl.ui.framelist.CreateNewEquivalentClassAction;
import org.protege.editor.owl.ui.framelist.OWLFrameList;
import org.protege.editor.owl.ui.view.cls.OWLClassDescriptionViewComponent;
import org.semanticweb.owlapi.model.OWLClass;

/**
* Author: Piotr Nowara<br>
* piotrnowara@gmail.com<br>
* code made available under Mozilla Public License (http://www.mozilla.org/MPL/MPL-1.1.html)<br>
* copyright 2013, Piotr Nowara<br>
*/
public class LinkedFactsCategoryView extends OWLClassDescriptionViewComponent
{

	/**
	 * 
	 */
	private static final long serialVersionUID = 5568563885406000324L;
    private OWLFrameList<OWLClass> list;

	
    public void initialiseClassView() throws Exception {
        list = new FactsDefinitioOWLFrameList<OWLClass>(getOWLEditorKit(), new LinkedFactsCategoryDescriptionFrame(getOWLEditorKit()));
        setLayout(new BorderLayout());
        JScrollPane sp = new JScrollPane(list);
        sp.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
        add(sp);
//        list.addToPopupMenu(new ConvertSelectionToEquivalentClassAction());
        list.addToPopupMenu(new CreateNewEquivalentClassAction<OWLClass>());
//        list.addToPopupMenu(new CreateClosureAxiomAction());
    }
    

    /**
     * This method is called to request that the view is updated with
     * the specified class.
     * @param selectedClass The class that the view should be updated with.  Note
     *                      that this may be <code>null</code>, which indicates that the view should
     *                      be cleared
     * @return The actual class that the view is displaying after it has been updated
     *         (may be <code>null</code>)
     */
    protected OWLClass updateView(OWLClass selectedClass) {
        list.setRootObject(selectedClass);
        return selectedClass;
    }


    public void disposeView() {
        list.dispose();
    }



}
